<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>扫雷游戏</title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/iconfont.css"/>
		<script src="js/flexible.js"></script>
		<link rel="stylesheet" href="css/xihongshihongbao.css" />
		<script src="js/jquery-3.1.1.js"></script>
		<script src="js/sprintf.min.js"></script>
		<link href="css/bootstrap.css" rel="stylesheet" />
		<script src="js/bootstrap.min.js"></script>
		<script src="js/iconfont.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/confi.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/template.js" type="text/javascript" charset="utf-8"></script>

	</head>

	<body>
		<header class="mui-bar mui-bar-nav" style="background-color: #ECECEC;">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: #000;"></a>
			<h1 class="mui-title">扫雷游戏</h1>
		</header>
		<header class="mui-bar mui-bar-nav" style="margin-top: 44px;background-color: #E02023;">
			<span style="display: inline-block;width: 0.8rem;height: 0.4rem;background: url(image/icon/icon_Left@2x.png)no-repeat;
				background-size: contain;position: absolute;top: 14px;left: 0.3rem;" id="confirmBtn"></span>
			<h1 class="mui-title" style="color: #fff;font-size: 0.45rem;">【公共大厅】<span id="gold"></span>&nbsp;踩雷<span id="odds"></span></h1>
			<a class="iconfont icon-airudiantubiaohuizhi-zhuanqu_youxi mui-pull-right" style="color: #fff;font-size: 20px;margin-top: 0.25rem;" id="gameExplain"></a>
		</header>
		<div>
			<ul id="redlist">
				<!--<li style="position: relative;padding: 0.2rem 0.3rem ;width: 100%;height: 3.5rem;">
				<img src="image/img_tx@2x.png" alt="" style="display: block;width: 1.2rem;height: 1.2rem;"/>
				<span style="position: absolute;top:0rem;left: 2rem;font-size: 0.4rem;">系统</span>
				<img src="image/hb_01@2x.png" alt="" style="display: block;width: 6.4rem;height: 2.5rem;position: absolute;top: 0.7rem;left: 1.8rem;"/>
				<div style="position: absolute;left:3.6rem;top: 1rem;z-index: 2;">
					<p style="font-size: 0.45rem;color: #fff;margin-bottom: 0.1rem;">游戏开始，祝你好运！</p>
					<p style="font-size: 0.45rem;color: #fff;">游戏红包</p>
				</div>
				<p style="position: absolute;left: 2.3rem;top: 2.5rem;color: #ccc;">疯狂的红包<span style="margin-left: 0.2rem;">未拆</span></p>
			</li>-->
			</ul>
		</div>
		<div class="mineBottom">
			<span id="send-btn" style="background-color: #FA4A24;color: #FFFFFF;">一键发包</span>
			<span id="coin" style="background-color: #ECECEC;"></span>
		</div>
		<!--
        	作者：18291958857@163.com
        	时间：2018-12-17
        	描述：发送红包
        -->
		<div id="sendRed">
			<header class="mui-bar mui-bar-nav" style="margin-top:44px;background-color: #E02023;z-index: 1000;">
				<a id="closeSend" class=" mui-pull-left" style="display:inline-block;color: #fff;font-size: 16px;padding: 10px 0;">关闭</a>
				<h1 class="mui-title" style="color: #fff;">发红包</h1>
			</header>
			<div>
				<div class="mui-input-row" style="margin: 0 0.4rem;background-color: #fff;padding: 0.1rem 0.2rem;">
					<div class="db">
						<span style="font-size: 0.45rem;">个数</span>
						<input id="redenv-num" type="text" value="7" style="text-align: right;width: 75%;background-color: #ECECEC;" disabled="disabled">

						<span style="font-size: 0.45rem;float: right;">个包</span>
						<div style="clear: both;"></div>
					</div>
					<div class="db">
						<span style="font-size: 0.45rem;">金额</span>
						<input id="redenv-money" type="text" placeholder="填写总数" style="text-align: right;width: 75%;">

						<span style="font-size: 0.45rem;float: right;">金币</span>
						<div style="clear: both;"></div>
					</div>
					<div class="db">
						<span style="font-size: 0.45rem;">地雷</span>
						<input id="redenv-spot" type="text" placeholder="输入地雷点数（0-9）" style="text-align: right;width: 75%;">

						<span style="font-size: 0.45rem;float: right;">雷点</span>
						<div style="clear: both;"></div>
					</div>
				</div>
			</div>
			<div style="text-align: center;margin-top: 0.3rem;">
				<span id="goldIn" style="font-size: 0.8rem;"></span><span style="font-size: 0.4rem;">金币</span>
			</div>
			<div class="mui-content" style="background: none;padding-top: 0;margin-top: 0.5rem;">
				<div class="mui-content-padded">
					<button id="send" type="button" class=" mui-btn-block" style="font-size: 0.4rem;background-color: #E02023;color: #fff;">塞金币进红包</button>
				</div>
			</div>
		</div>
		<!--<div id="modal" class="modal fade" tabindex="-1" role="dialog">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title">发红包</h4>
					</div>
					<div class="modal-body">-->
		<!-- 红包分数要动态获取 -->
		<!--<p>红包份数：<input id="redenv-num" value="3" readonly="true" /></p>
						<p>红包金额：<input id="redenv-money" /></p>
						<p>雷 点：<input id="redenv-spot" /></p>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" id="send">确定</button>
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>
				</div>-->
		<!-- /.modal-content -->
		<!--</div>-->
		<!-- /.modal-dialog -->
		<!--</div>-->
		<!-- /.modal -->
		<!--
    	作者：18291958857@163.com
    	时间：2018-12-17
    	描述：打开红包
    -->
		<div id="fadeeth" class="black_overlay">
		</div>
		<!--
    	作者：18291958857@163.com
    	时间：2018-12-17
    	描述：红包未抢完
    -->
		<div id="MyDiveth" class="white_content" style="background: url(image/icon/img_di@2x.png)no-repeat;background-size: cover;">
			<div style="width: 88%;position: fixed;">
				<span class="mui-pull-left" style="font-size: 16px; padding-top: 0.4rem; padding-left: 0.4rem;" onclick="CloseDiv('MyDiveth','fadeeth')"> <img id="imgClose" style="width: 0.5rem; height: 0.5rem;" src="image/icon/icon_Close@2x.png" alt="" /></span>
			</div>
			<div style="text-align: center;margin: 0 auto;margin-top:1rem;">
				<img src="image/icon/icon_tx@2x.png" alt="" style="display: block;width: 1.2rem;height: 1.2rem;margin: 0 auto;" />
				<p id="hName" style="font-size: 0.4rem;color: #FFDEAD;margin-top: 0.2rem;"></p>
				<p style="font-size: 0.4rem;color: #FFDEAD;margin-top: 0.2rem;">发送了一个红包</p>
				<p style="font-size: 0.6rem;margin-top: 0.7rem;color: #FFDD8D;"><span id="gload"></span>金币/雷<span id="bao"></span></p>
			</div>
			<img id="redOpen" src="image/icon/img_kai@2x.png" alt="" style="display: block;width: 2.3rem;height: 2.3rem;position: absolute;bottom: 3.3rem;left: 3.3rem;" />
		</div>
		<!--
    	作者：18291958857@163.com
    	时间：2018-12-17
    	描述：红包抢完了
    -->
		<div id="grab" class="white_content" style="background: url(image/icon/img_di@2x.png) no-repeat;background-size: cover;">
			<div style="width: 88%;position: fixed;">
				<span class="mui-pull-left" style="font-size: 16px; padding-top: 0.4rem; padding-left: 0.4rem;" onclick="CloseDiv('grab','fadeeth')"> <img  style="width: 0.5rem; height: 0.5rem;" src="image/icon/icon_Close@2x.png" alt="" /></span>
			</div>
			<div style="text-align: center;margin: 0 auto;margin-top:1rem;">
				<img  src="image/icon/icon_tx@2x.png" alt="" style="display: block;width: 1.2rem;height: 1.2rem;margin: 0 auto;" />
				<p id="grabName" style="font-size: 0.4rem;color: #FFDEAD;margin-top: 0.2rem;"></p>
				<p style="font-size: 0.4rem;color: #FFDEAD;margin-top: 0.2rem;"></p>
				<p style="font-size: 0.6rem;margin-top: 0.7rem;color: #FFDD8D;">手慢了，红包派完了</p>
			</div>
			<div class="openHand" style="text-align: center;margin-top: 5rem;font-size: 0.4rem;color: #FFDEAD;">
				查看大家的手气>
			</div>
		</div>
		<!--
    	作者：18291958857@163.com
    	时间：2018-12-17
    	描述：红包详情
    -->
		<div id="redEnvelope">
			<div class="mui-bar-nav" style="background-color: #fff;height: 5.5rem;padding: 0;box-shadow: inherit;">
				<span style="display: block;height: 3rem;width: 100%;top: 0;left: 0;position: relative;">
			<img src="image/icon/bg_hu@2x.png" alt="" style="width: 100%;height: 3rem;" />
			<a id="close" class="mui-pull-left" style="display:inline-block;color: #fff;font-size: 16px;position: absolute;top: 0;left: 0.2rem;padding: 10px 0;z-index: 100;" >关闭</a>
			<h1  class="mui-title" style="color: #FFD988;position: absolute;top: 0;">红包详情</h1>
			<span style="display: block;width:1rem;height: 1rem;position: absolute;top: 2.6rem;left: 4.5rem;background: url(image/icon/icon_tx@2x.png) no-repeat;
				background-size: cover;"></span>
				<p id="xName" style="text-align: center;color: #000;margin-top: 0.6rem;"></p>
				<p style="text-align: center;color: red;margin-top: 0.3rem;"><span id="xgload" style="font-size: 0.8rem;"></span><span>金币</span></p>
				</span>

			</div>
			<div style="width: 100%;height: 1.5rem;background-color: #F1F1F1;font-size: 0.4rem;line-height: 1.5rem;padding-left: 0.3rem;
		border: 1px solid #ccc;">
				已领取<span id="received"></span>/<span id="sum"></span>个，共<span id="sumgload"></span>
			</div>
			<div style="width: 100%;">
				<ul id="getredlist" class="mui-table-view">

				</ul>
			</div>
		</div>
		<!--
        	作者：18291958857@163.com
        	时间：2018-12-20
        	描述：游戏说明
        -->
		<div id="gameM">
			<header class="mui-bar mui-bar-nav" style="background-color: #ECECEC;">
				<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: #000;"></a>
				<h1 class="mui-title">扫雷游戏</h1>
			</header>
			<header class="mui-bar mui-bar-nav" style="margin-top: 44px;background-color: #E02023;">
				<a id="closeGame" class=" mui-pull-left" style="display:inline-block;color: #fff;font-size: 16px;padding: 10px 0;">关闭</a>
				<h1 class="mui-title" style="color: #fff;">游戏说明</h1>
			</header>
			<div style="margin-top: 88px;width: 100%;height: 1.5rem;line-height: 1.5rem;padding-left: 0.3rem;">
				<p id="gameCon" style="color: #000;"></p>
			</div>
		</div>
		<!--
        	作者：18291958857@163.com
        	时间：2018-12-17
        	描述：红包抢购记录模板
        -->
		<script type="text/template" id="redLists">
			{{each items as value index}}
			<li class="mui-table-view-cell mui-media">
				<a href="javascript:;">
					<img class="mui-media-object mui-pull-left" src="image/icon/icon_tx@2x.png">
					<div class="mui-media-body">
						<span>{{value.name}}</span>
						<p class="mui-ellipsis">{{value.create_time}}</p>
						<span class="qianbi">{{value.money}}</span>
					</div>
				</a>
			</li>
			{{/each}}
		</script>
		<script>
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});
			//			mui('.mui-scroll-wrapper').scroll();
			mui('body').on('shown', '.mui-popover', function(e) {
				//console.log('shown', e.detail.id);//detail为当前popover元素
			});
			mui('body').on('hidden', '.mui-popover', function(e) {
				//console.log('hidden', e.detail.id);//detail为当前popover元素
			});
			//关闭弹出层
			function CloseDiv(show_div, bg_div) {
				document.getElementById(show_div).style.display = 'none';
				document.getElementById(bg_div).style.display = 'none';
			};
			$(".zz").click(function() {
				$(".zz").hide();
				$("#topPopover11").hide();
				$("#topPopover11").removeClass("mui-active");
			})
			$('#sendRed').css('height', ($(document).height() - 90));
			/*获取我的账户*/
			var token = localStorage.getItem('token');
			mui.ajax(config.host + '/home/User/myAccount ', {
				headers: {
					'token': token
				},
				dataType: 'json', //服务器返回json格式数据
				type: 'get', //HTTP请求类型	              
				success: function(data) {
					if(data.code == 200) {
						$('#goldIn').text(data.data.user_gold);
						$('#coin').text("余 额："+data.data.user_gold);
					} else {
						mui.toast(data.msg)
					}
				}
			});
			/*关闭塞进红包弹窗*/
			$("#closeSend").click(function() {
				$('#sendRed').css('display', 'none');
			})
			//关闭红包详情
			$("#close").click(function() {
				document.getElementById('redEnvelope').style.display = 'none';
				document.getElementById('fadeeth').style.display = 'none';
			})
			//关闭打开红包
			$('#imgClose').click(function() {
				document.getElementById('MyDiveth').style.display = 'none';
				document.getElementById('fadeeth').style.display = 'none';
			})
			//查看手气
			$('.openHand').click(function() {
				document.getElementById('grab').style.display = 'none';
				document.getElementById('redEnvelope').style.display = 'block';
			})
			//退出房间
			document.getElementById("confirmBtn").addEventListener('tap', function() {
				var btnArray = ['否', '是'];
				mui.confirm('确定退出房间', '提示', btnArray, function(e) {
					if(e.index == 1) {
						location.href = 'mineClearance.html'
					} else {

					}
				})
			});
			//打开游戏说明
			$('#gameExplain').on('tap', function() {
				$('#gameM').css('display', 'block');
			})
			//关闭游戏说明
			$('#closeGame').on('tap', function() {
				$('#gameM').css('display', 'none');
			})
		</script>
		<script>
			var token = localStorage.getItem('token');
			var loc = location.href;
			var locArr = loc.split('='); //=号截取数据
			var roomId = Number(locArr[1]);
			var roomType = Number(locArr[3]);
			$('#gold').text(locArr[5] + "金币");
			$('#odds').text(locArr[7]);
			//游戏说明
			mui.ajax(config.host + '/home/User/gameRule', {
				headers: {
					'token': token
				},
				dataType: 'json', //服务器返回json格式数据
				type: 'post', //HTTP请求类型	
				data: {
					'room_id': roomId
				},
				success: function(data) {
					if(data.code == 200) {
						if(data.data.length != 0) {
							$('#gameCon').text(data.data.gameIntro);
						} else {
							mui.toast(data.msg);
						}

					} else {
						mui.toast(data.msg)
					}
				}
			});
			var Room = {
				socket: null,
				uid: 0,
				users: [],
				pingInterval: 0,
				init: function() {
					// 创建一个Socket实例
					this.socket = new WebSocket(config.ws_url + '/?roomId=' + roomId + '&token=' + token + '&roomType=' + roomType);
					// 打开Socket 
					this.socket.onopen = function(event) {
						if(this.pingInterval) clearInterval(this.pingInterval);
						this.pingInterval = setInterval(function() {
							Room.send({
								'type': 'ping',
								'time': new Date().getTime()
							})
						}, 10000);
						setTimeout(function() {
							Room.send({
								'type': 'users'
							})
						}, 300);
						// 监听消息
						this.socket.onmessage = function(event) {
							var data = $.parseJSON(event.data);
							console.log('接收:', data);
							if(data.status !== 0) {
								mui.toast(data.msg);
								return;
							}
							switch(data.type) {
								case 'pong':
									break;
								case 'login':
									this.login(data.data);
									break;
								case 'sendResult':
									this.sendResult(data.data);
									break;
								case 'redEnvInfo':
									this.redEnvInfo(data.data);
									break;
								case 'openResult':
									this.openResult(data.data);
									break;
								case 'snatchResult':
									this.snatchResult(data.data);
									break;
								case 'snatchInfo':
									this.snatchInfo(data.data);
									break;
								case 'usersResult':
									this.usersResult(data.data);
									break;
								case 'logout':
									this.logout(data.data);
									break;
								case 'startGame':
									this.startGame(data.data);
									break;
								case 'prizeMes':
									this.prizeMes(data.data);
									break;
								case 'isStepThunder':
									this.isStepThunder(data.data);
									break;
								case 'pushUncollected':
									this.pushUncollected(data.data);
									break;
								case 'sendThunderPrize':
									this.sendThunderPrize(data.data);
									break;
							}
						}.bind(this);

						// 监听Socket的关闭
						this.socket.onclose = function(event) {
							if(this.pingInterval) clearInterval(this.pingInterval);
							$('.alert').show();
							console.log('Client notified socket has closed', event);
						}.bind(this);
					}.bind(this);

					this.bind();
				},
				send: function(e) {
					console.info('发送:', e);
					this.socket.send(JSON.stringify(e));
				},
				bind: function() {
					$('#send-btn').click(function() {
						$('#sendRed').css('display', 'block');
					}.bind(this));
					$('#send').click(function() {
						this.send({
							'type': 'send',
							'money': $('#redenv-money').val(),
							'num': $('#redenv-num').val(),
							'spot': $('#redenv-spot').val()
						});
					}.bind(this));
					$('#start').click(function() {
						Room.send({
							'type': 'start'
						});
					});
					$(document).on('click', '.red', function() {
						Room.send({
							'type': 'open',
							'reCode': $(this).attr('reCode')
						});
					});
				},
				logout: function(e) {
					$(sprintf('#uid-%s', e.uid)).remove();
					//	        $('.info-list').append(sprintf('<span style="text-align: center;font-size: 0.3rem;color: red;background-color: red;" >%s 退出房间</span>', e.name));
					$('.info-list')[0].scrollTo(0, 999999);
				},
				login: function(e) {
					this.joinRoom(e);
					if(e.roomType == 2) {
						$('#pNum').html(sprintf('<p style="text-align: center;font-size: 0.3rem;color: #fff;">请稍等，游戏需要%s 位玩家，当前%s 位</p>', e.sum, e.num));
					} else {
						//	        	$('#pNum').hide();			// 需要去掉
					}
					//					$('#redlist').append(sprintf('<p style="text-align: center;font-size: 0.3rem;color: red;background-color:transparent;">%s 加入房间</p>', e.name));
					//					$('#redlist')[0].scrollTo(0, 999999);
					if(e.sum == e.num) {
						$('#start').attr('disabled', false);
					}
				},
				joinRoom: function(e) {
					$(sprintf('#uid-%s', e.uid)).remove();
					var $li = $('<li class="line-group-item user" id=""><name></name><ready></ready><point></point></li>');
					$li.find('name').text(e.name);
					$li.attr('id', sprintf('uid-%d', e.uid));
					$('.line-group-head').after($li);
					this.users[e.uid] = e;
				},
				sendResult: function(e) {
					$('.user-money').html(e.moneyInfo);
					$('#sendRed').css('display', 'none');
				},
				redEnvInfo: function(e) {
					$('#redlist').append(sprintf('<li class="redIn"><img src="image/icon/img_tx@2x.png" alt="" style="display: block;width: 1.2rem;height: 1.2rem;"/><span style="position: absolute;top:0rem;left: 2rem;font-size: 0.4rem;">%s </span><img class="red" reCode="%s" src="image/icon/hb_01@2x.png" alt="" style="display: block;width: 6.4rem;height: 2.5rem;position: absolute;top: 0.7rem;left: 1.8rem;"/><div class="red" reCode="%s" style="position: absolute;left:3.6rem;top: 1rem;z-index: 2;"><p style="font-size: 0.45rem;color: #fff;margin:0">%s金币/雷%s</p><p style="font-size: 0.45rem;color: #fff;">游戏红包</p></div><p style="position: absolute;left: 2.3rem;top: 2.5rem;color: #ccc;">疯狂的红包<span class="demolition" style="margin-left: 0.2rem;" id="%s">未拆</span></p></li>', e.name, e.reCode,e.reCode,e.money,e.spot, e.reCode));
					$('#redlist')[0].scrollTo(0, 999999);
					window.scrollTo(0, 999999);
				},
				openResult: function(e) {
					if(e.isSnatched) {
						//						alert(sprintf("红包信息\n红包code:%s\n发送人:%s\n金额:%s\n份数:%s\n我抢到:%s\n详情查看console", e.reCode, e.name, e.money, e.num, e.snatchMoney));
						document.getElementById('redEnvelope').style.display = 'block';
						document.getElementById('fadeeth').style.display = 'block';
						document.getElementById('MyDiveth').style.display = 'none';
						$('#xName').text(e.snatchUser);
						$('#xgload').text(e.snatchMoney);
						$('#received').text(e.snatchList[0].num); //已领取的红包数
						$('#sum').text(e.num); //总共的红包数
						$('#sumgload').text(e.money); //总共的金币
						var redArr = $('body').find('.red');
						console.log(e.reCode);
						redArr.map(function(index, item) {
							console.log(e.reCode);
							if($('.red').eq(index).attr('recode') == e.reCode) {
								$('.red').eq(index).attr('src', 'image/icon/hb_02@2x.png'); //修改钱包图片
							}
						})
						$(sprintf('#%s', e.reCode)).html('已拆');
						$('#redEnvelope').css('top', 0);
						if(e.snatchList.length != 0) {
							var redData = e.snatchList;
							var redHtml = template('redLists', {
								"items": e.snatchList
							});
							$('#getredlist').html(redHtml);
						}
						console.log('红包详情:', e);
						return;
					}

					if(e.canSnatch) {
						//						if(confirm(sprintf('抢到了 %s 的红包，确认打开？', e.name))) {
						//							this.send({
						//								'type': 'snatch',
						//								'reCode': e.reCode
						//							});
						//						}
						document.getElementById('fadeeth').style.display = 'block';
						document.getElementById('MyDiveth').style.display = 'block';
						var bgdiv = document.getElementById('fadeeth');
						bgdiv.style.width = document.body.scrollWidth;
						$("#fadeeth").height($(document).height());
						$('#hName').text(e.name);
						$('#gload').text(e.money);
						$('#bao').text(e.spot);
						//打开红包
						var that=this;
						$('#redOpen').click(function() {
							document.getElementById('fadeeth').style.display = 'block';
							document.getElementById('MyDiveth').style.display = 'none';
							document.getElementById('redEnvelope').style.display = 'block';
							$('#redEnvelope').css('top', 0);
							that.send({
								'type': 'snatch',
								'reCode': e.reCode
							});
						});
						return;
					}
					//
										alert(sprintf("红包信息\n红包code:%s\n发送人:%s\n金额:%s\n份数:%s\n红包已被抢完", e.reCode, e.name, e.money, e.num));
										console.log('红包详情:', e);
					document.getElementById('grab').style.display = 'block';
					$('#grabName').text(e.name);
				},
				snatchResult: function(e) {
					if(e.moneyInfo) $('.user-money').html(e.moneyInfo);
					this.openResult(e);
				},
				snatchInfo: function(e) {
					$('.info-list').append(sprintf('<span class="info">%s 抢了 %s 的红包</span>', e.snatchUser, e.name));
					$('.info-list')[0].scrollTo(0, 999999);
				},
				usersResult: function(e) {
					for(var i = 0; i < e.length; e++) {
						this.joinRoom(e[i]);
					};
					/*$('#redlist').mCustomScrollbar();
					$(document).ready(function() {
						$('#redlist').mCustomScrollbar("scrollTo", "bottom", {
							scrollEasing: 'easeOut'
						});
					});
					$('#redlist').scrollTop($('#redlist')[0].scrollHeight);
					console.log($('#redlist')[0].scrollHeight);*/
				},
				startGame: function(e) {
					$('#redlist').append(sprintf('<li class="redIn"><img src="image/icon/img_tx@2x.png" alt="" style="display: block;width: 1.2rem;height: 1.2rem;"/><span style="position: absolute;top:0rem;left: 2rem;font-size: 0.4rem;">%s </span><img class="red" reCode="%s" src="image/icon/hb_01@2x.png" alt="" style="display: block;width: 6.4rem;height: 2.5rem;position: absolute;top: 0.7rem;left: 1.8rem;"/><div class="red" reCode="%s" style="position: absolute;left:3.6rem;top: 1rem;z-index: 2;"><p style="font-size: 0.45rem;color: #fff;margin:0">%s金币/雷%s</p><p style="font-size: 0.45rem;color: #fff;">游戏红包</p></div><p style="position: absolute;left: 2.3rem;top: 2.5rem;color: #ccc;">疯狂的红包<span style="margin-left: 0.2rem;" id="%s">未拆</span></p></li>', e.name, e.reCode,e.reCode,e.money,e.spot, e.reCode));
					$('#start').attr('disabled', true);
					window.scrollTo(0, 999999);
				},
				prizeMes: function(e) {
					$('#redlist').append(sprintf('<p style="text-align: center;font-size: 0.3rem;color: red;background-color:transparent;" >恭喜 %s 抢到 %s 获得 %s 奖励</p>', e.name, e.snatch, e.prize));
					window.scrollTo(0, 999999);
				},
				isStepThunder: function(e) {
					$('#redlist').append(sprintf('<p style="text-align: center;font-size: 0.3rem;color: red;background-color:transparent;" >%s 踩到了雷</p>', e.name));
					window.scrollTo(0, 999999);
				},
				pushUncollected: function(e) {
					$.each(e, function(k, v) {
						$('#redlist').append(sprintf('<li class="redIn"><img src="image/icon/img_tx@2x.png" alt="" style="display: block;width: 1.2rem;height: 1.2rem;"/><span style="position: absolute;top:0rem;left: 2rem;font-size: 0.4rem;">%s </span><img class="red" reCode="%s" src="image/icon/hb_01@2x.png" alt="" style="display: block;width: 6.4rem;height: 2.5rem;position: absolute;top: 0.7rem;left: 1.8rem;"/><div class="red" reCode="%s" style="position: absolute;left:3.6rem;top: 1rem;z-index: 2;"><p style="font-size: 0.45rem;color: #fff;margin:0">%s金币/雷%s</p><p style="font-size: 0.45rem;color: #fff;">游戏红包</p></div><p style="position: absolute;left: 2.3rem;top: 2.5rem;color: #ccc;">疯狂的红包<span style="margin-left: 0.2rem;" id="%s">未拆</span></p></li>', v.name, v.reCode,v.reCode,v.money,v.spot, v.reCode));
						window.scrollTo(0, 999999);
					});
				},
				sendThunderPrize: function(e) {
					$('#redlist').append(sprintf('<p style="text-align: center;font-size: 0.3rem;color: red;background-color:transparent;" >恭喜  %s 发出  %s 个雷  获得 %s 奖励</p>', e.name, e.thunderNum, e.prizeMoney));
					window.scrollTo(0, 999999);
				},
			};
			Room.init();
			/*获取房间信息*/
			mui.ajax(config.host + '/home/GameHall/roomInfo', {
				headers: {
					'token': token
				},
				data: {
					'roomId': roomId
				},
				dataType: 'json', //服务器返回json格式数据
				type: 'get', //HTTP请求类型                
				success: function(data) {
					console.log(data);
					if(data.code == 200) {
						$('#redenv-num').val(data.data.pocks);
					} else {
						mui.toast(data.msg)
					}
				}
			});
		</script>
	</body>

</html>